package metrics

import (
	"github.com/prometheus/client_golang/prometheus"
	"github.com/zeromicro/go-zero/core/metric"
)

var (
	// HTTP 探测指标
	httpProbeDuration = metric.NewHistogramVec(
		&metric.HistogramVecOpts{
			Name:   "http_probe_duration_seconds",
			Help:   "HTTP 请求的持续时间（秒）",
			Labels: []string{"target"},
		},
	)

	httpProbeStatusCode = metric.NewGaugeVec(
		&metric.GaugeVecOpts{
			Name:   "http_probe_status_code",
			Help:   "HTTP 请求的响应状态码（0 表示请求失败）",
			Labels: []string{"target"},
		},
	)
	httpProbeSuccess = metric.NewGaugeVec(
		&metric.GaugeVecOpts{
			Name:   "http_probe_success",
			Help:   "HTTP 请求是否成功（1=成功，0=失败）",
			Labels: []string{"target"},
		},
	)

	// TCP 探测指标
	tcpProbeDuration = metric.NewHistogramVec(
		&metric.HistogramVecOpts{
			Name:    "tcp_probe_duration_seconds",
			Help:    "TCP 探测的持续时间（秒）",
			Buckets: prometheus.DefBuckets,
			Labels:  []string{"target"},
		},
	)

	tcpProbeSuccess = metric.NewGaugeVec(
		&metric.GaugeVecOpts{
			Name:   "tcp_probe_success",
			Help:   "TCP 探测是否成功（1=成功，0=失败）",
			Labels: []string{"target"},
		},
	)

	// DNS 探测指标
	dnsProbeDuration = metric.NewHistogramVec(
		&metric.HistogramVecOpts{
			Name:    "dns_probe_duration_seconds",
			Help:    "DNS 请求的响应时间（秒）",
			Buckets: prometheus.DefBuckets,
			Labels:  []string{"target"}, // 标签：目标域名、DNS服务器
		},
	)

	dnsProbeSuccess = metric.NewGaugeVec(
		&metric.GaugeVecOpts{
			Name:   "dns_probe_success",
			Help:   "DNS 请求是否成功（1=成功，0=失败）",
			Labels: []string{"target"},
		},
	)
)
